package com.borya.record;

import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;

import com.borya.framework.annotation.Autowired;
import com.borya.framework.annotation.Component;
import com.borya.record.sender.FutureCallback;
import com.borya.record.sender.ReceiveProcess;
import com.borya.record.sender.RecordSender;

@Component
public class RecordProxy {

	
	private final Logger log = LogManager.getLogger(getClass());  
	
	
	@Autowired("kafkaRecordSender")
	private RecordSender sender;
	
	public void send(String key, String msg) {
		sender.send(key, msg);
	}
	
	public void send(String topic, String key, String data) {
		send(topic, key, data,null);
	}
	
	public void send(String topicName,String key,String msg,FutureCallback callback) {  
		log.info("SEND : topic"+topicName+",key="+key+",msg="+msg);
		sender.send(topicName, key, msg, callback);
	}
	
	public void onReceiver(ReceiveProcess process){
		sender.onReceiver(process);
	}
	
	public void close(){
		sender.close();
	}
}
